-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optional xblocks #638
base: opencraft-release/palm.1
Are you sure you want to change the base?
Conversation
2fee526
to
42451ca
Compare
optional_completion: this.model.get('optional_completion'), | ||
optionalAncestor: this.model.get('ancestor_has_optional_completion') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we should not mix the snake_case with camelCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -14,7 +14,7 @@ class BlockCompletionTransformer(BlockStructureTransformer): | |||
Keep track of the completion of each block within the block structure. | |||
""" | |||
READ_VERSION = 1 | |||
WRITE_VERSION = 1 | |||
WRITE_VERSION = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this seems to be a backward-compatible change, so we can revert bumping this version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
@@ -437,3 +437,18 @@ def test_cannot_enroll_if_full(self): | |||
self.update_course_and_overview() | |||
CourseEnrollment.enroll(UserFactory(), self.course.id) # grr, some rando took our spot! | |||
self.assert_can_enroll(False) | |||
|
|||
def test_optional_completion(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we use a more verbose name for this test, like "test_optional_completion_off_by_default"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea!
if xblock_info['optional_completion']: | ||
xblock_info['ancestor_has_optional_completion'] = ancestor_has_optional_completion(xblock, parent_xblock) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the optional_completion
is set to False
(default), but the parent XBlock has it set to True
? In this use case, the field is still active. We should disable this checkbox when ancestor_has_optional_completion
returns True
, regardless of the xblock_info['optional_completion']
value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point
tabs[1].editors = [StaffLockEditor]; | ||
} else if (xblockInfo.isSequential()) { | ||
tabs[0].editors = [ReleaseDateEditor, GradingEditor, DueDateEditor]; | ||
tabs[0].editors = [ReleaseDateEditor, GradingEditor, DueDateEditor, OptionalCompletionEditor]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding this comment about hiding the editor when the completion tracking is not enabled, please see the following parts of code that handle a similar scenario for another editor:
edx-platform/cms/templates/base.html
Line 160 in a8535ff
is_custom_relative_dates_active: ${CUSTOM_RELATIVE_DATES.is_enabled(context_course.id) | n, dump_js_escaped_json}, |
I think we shouldn't move this to a follow-up ticket because this feature is not enabled by default in edx-platform
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow i didn't realize it'd be so straight forward. implementing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. I wasn't able to test it manually without hardcoding the value in the base.html. it seems waffle flags are cached somewhere and take quite some time to invalidate the cache.
In case you want to test it and have my same problem you can hard code completion_tracking_enabled
to False
in cms/templates/base.html
line 162.
<%- gettext('Optional') %> | ||
<% } %> | ||
<p class="field-message"> | ||
<% var message = gettext('Optional %(xblockType)ss won\'t count towards course or parent completion. Only has an effect if completion module is enabled.') %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<% var message = gettext('Optional %(xblockType)ss won\'t count towards course or parent completion. Only has an effect if completion module is enabled.') %> | |
<% var message = gettext('Optional %(xblockType)ss won\'t count towards course or parent completion.') %> |
Once we hide the editor when the completion tracking is not enabled, we can remove this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
487ae2d
to
a2968d0
Compare
]); | ||
appendSetFixtures(mockOutlinePage); | ||
mockCourseJSON = createMockCourseJSON({}, [ | ||
createMockSectionJSON({}, [ | ||
createMockSectionJSON({completion_tracking_enabled: true}, [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DanielVZ96, the completion tracking should be enabled for the course instead of the section.
Also, you should be able to use something like console.warn(window. course)
to verify that it's applied correctly.
3f0b03c
to
f7745fd
Compare
3046507
to
84ad5ee
Compare
d1618cb
to
e57c355
Compare
Description
This PR implements separating optional progress from normal progress, and also displaying optional chapters and sequences in the outline.
Supporting information
Testing instructions
Screenshots
Private-ref: https://tasks.opencraft.com/browse/BB-8586